Skip to content

Port chainlist L2/testnet relations fix + CLAUDE.md + sources UI#43

Merged
Johnaverse merged 2 commits into
mainfrom
claude/port-chainlist-relations-and-docs
May 14, 2026
Merged

Port chainlist L2/testnet relations fix + CLAUDE.md + sources UI#43
Johnaverse merged 2 commits into
mainfrom
claude/port-chainlist-relations-and-docs

Conversation

@Johnaverse
Copy link
Copy Markdown
Owner

Summary

Forward-port of the abandoned claude/add-claude-documentation-AiTVH branch (2 commits, written against pre-refactor main) onto the post-PR-#39 src/ architecture.

1. Bug fix — chainlist L2/testnet relations (src/store/indexer.js)

indexChainlistSource only ran mergeBridges in its second pass, so a chain that appeared only in chainlist with a parent.type of L2 or testnet never got its l2Of / testnetOf relation, the corresponding L2 tag, or a reverse parentOf / mainnetOf on the parent chain. Now calls processL2ParentRelation and processTestnetParentRelation with source='chainlist'.

Both helpers gained an optional source parameter (defaults to 'chains') so attribution is correct. addReverseRelations already propagates relation.source, so reverse relations get the right attribution for free. Existing dedup logic handles the case where both chains.json and chainlist declare the same parent.

2. CLAUDE.md (new)

Rewritten from the original branch's text to match the current architecture: layered src/ diagram (transport → sources → store → domain → services → http), 5 data sources (adds L2BEAT), full endpoint list (/scaling, /metrics, /refresher, /clients, /validate, /relations/:id/graph, etc.), pino logging, JSON Schema validation, ESLint, refreshed env-var table.

3. Sources toggle UI (public/*)

Bottom-right toggle panel — enable/disable individual data sources to filter the 3D graph. Originally 4 sources in the source branch; bumped to 5 here to include L2BEAT. enabledSources.size === ALL_SOURCES.length short-circuit is generalized so adding a 6th source later is one-line.

Test plan

  • npm test675 passed / 4 skipped / 0 failing (was 670 on main; +5 new tests)
  • npm run lint → clean
  • 5 new test cases in tests/unit/store/indexer-chainlist-relations.test.js:
    • L2 relation extraction from chainlist parent
    • testnet relation extraction from chainlist parent
    • no duplicate relations when chains.json and chainlist agree
    • reverse parentOf created with source='chainlist'
    • reverse mainnetOf created with source='chainlist'
  • Manual smoke test of the sources toggle UI in a browser (load /ui/, toggle each source, confirm the 3D graph re-renders)

Provenance

Replaces and supersedes the claude/add-claude-documentation-AiTVH branch (commits fc95594, 79102d2), which was written against the pre-refactor dataService.js monolith and wouldn't apply cleanly to the new src/ layout.


Generated by Claude Code

claude added 2 commits May 14, 2026 01:59
Rewrites the AI assistant context doc to match the post-PR-#39
architecture. Updates the source-layer diagram (transport → sources →
store → domain → services → http), bumps the data-source count to 5
(adds L2BEAT), lists the new endpoints (/scaling, /metrics, /refresher,
/clients, /relations/:id/graph, /keywords, /stats, /validate), notes
pino logging, JSON Schema validation, and ESLint, and updates env
vars + tests folder layout. The "Common tasks" section is rewritten
to point at src/ paths instead of dataService.js / index.js.
Bug fix
-------
Chainlist entries with parent.type === 'L2' or 'testnet' were not being
processed for relations — only the bridge URLs were extracted, so a
chain that appeared only in chainlist (with a parent declaration) never
got its l2Of / testnetOf relation, the corresponding L2 tag, or the
reverse parentOf / mainnetOf relation on the parent.

In src/store/indexer.js, indexChainlistSource now calls
processL2ParentRelation and processTestnetParentRelation in the chainlist
second pass with source='chainlist'. Both helpers take an optional
source parameter (default 'chains') so the same code path can attribute
relations correctly. addReverseRelations already propagates the source
to the reverse side, so chainlist-sourced relations also produce
correctly-attributed reverse relations on the parent chain.

Existing dedup logic (existingRelation check by kind + chainId) handles
the case where both chains.json and chainlist declare the same parent.

UI
--
public/* adds a Sources toggle panel (bottom-right) that lets users
enable/disable individual data sources (Chain ID Network, Chainlist,
The Graph, SLIP-0044, L2BEAT). Toggling a source filters the 3D graph
to show only chains whose sources array intersects the enabled set,
and rebuilds the relations map accordingly.

Tests
-----
tests/unit/store/indexer-chainlist-relations.test.js (new file, 5 cases):
- L2 relation extraction from chainlist parent
- testnet relation extraction from chainlist parent
- no duplicate relations when chains.json and chainlist agree
- reverse parentOf created with source='chainlist'
- reverse mainnetOf created with source='chainlist'
Copilot AI review requested due to automatic review settings May 14, 2026 02:45
@Johnaverse Johnaverse merged commit db07a21 into main May 14, 2026
7 checks passed
@Johnaverse Johnaverse deleted the claude/port-chainlist-relations-and-docs branch May 14, 2026 02:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR forward-ports an abandoned branch onto the post-PR-#39 src/ architecture by fixing chainlist-derived L2/testnet parent relations in the indexer, adding a new CLAUDE.md architecture/developer guide, and introducing a UI panel to toggle which data sources are shown in the public 3D graph.

Changes:

  • Fixes chainlist-only L2/testnet parent relations by attributing relations to source='chainlist' during indexing.
  • Adds a “Sources” toggle panel in the static UI to filter the displayed graph by data source.
  • Introduces CLAUDE.md documenting architecture, workflows, endpoints, and conventions.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/store/indexer.js Attributes chainlist parent relations properly by invoking parent-relation processors during chainlist indexing.
tests/unit/store/indexer-chainlist-relations.test.js Adds unit coverage for chainlist-derived parent relations and reverse relations attribution.
public/index.html Adds the Sources toggle panel markup to the UI.
public/app.js Implements source-based filtering and graph rebuild logic in the client UI.
public/style.css Styles the Sources panel and custom checkbox toggles.
CLAUDE.md Adds a repo-specific developer/architecture reference document aligned to the new src/ layout.

Comment thread src/store/indexer.js
processL2ParentRelation(chainData, indexed, 'chainlist');
processTestnetParentRelation(chainData, indexed, 'chainlist');

if (chainData.parent?.bridges) {
Comment thread public/index.html
Comment on lines +61 to +70
<div id="sourcesPanel" class="glass-panel sources-panel">
<button id="sourcesToggle" class="sources-toggle" aria-label="Toggle data sources">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="3"></circle>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
</svg>
<span>Sources</span>
</button>
<div id="sourcesDropdown" class="sources-dropdown hidden">
Comment thread public/style.css
flex-shrink: 0;
transition: background 0.15s, border-color 0.15s;
}

Comment thread CLAUDE.md

## Testing

**Framework:** Vitest with globals enabled (no explicit imports needed for `describe`, `it`, `expect`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants